<?php
/**
 * Created by PhpStorm.
 * User: Adminstratot
 * Date: 2018/10/31
 * Time: 20:44
 */
namespace Admin\Model;
use Think\Model;

class UserModel extends Model{
    protected $connection = 'DB_USER';//连接默认数据库时不写即可


    protected $insertFields='uid,account,password,repwd,email,salt';

    protected $_auto=array(
        //array(完成字段1,完成规则,[完成条件,附加规则]),
        array('re_time','time',3,'function'),
    );

    protected $_validate=array(
        //array(验证字段1,验证规则,错误提示,[验证条件,附加规则,验证时间])
        array('account','1,50','账号长度不符合要求!',1,'length',3),
        array('account','','账号已存在!',1,'unique',3),
        array('password','6,20','密码长度要求为6到20位',1,'length',3),
        array('repwd','password','两次密码不一致',1,'confirm',3),
        array('email','email','邮箱格式不合法！',1,'',3),
    );
}

?>